{% extends "base.html" %}

{% block body_class_name %}user{% endblock %}
{% block container_class_name %}dashboard{% endblock %}

{% block container %}

<div class="subhead">
  <div class="container">
    <h2 class="heading">我的仓库<span class="count">({{userprofile.get_total_repo}})</span></h2>
  </div>
</div>

<div class="content">
  <div class="container">
    <div class="user-repos inner bubble">

      {% load humanize %}

      {% if repo_list %}
        {% for repo in repo_list %}
          <section class="repo c_repo">

            <ul class="meta">
              <li><a href="#"><span class="count">{{repo.commit}}</span><span class="meta-type">提交</span></a></li>
              <li><a href="#"><span class="count">{{repo.fork}}</span><span class="meta-type">派生</span></a></li>
              <li><a href="#"><span class="count">{{repo.watch}}</span><span class="meta-type">关注</span></a></li>
            </ul>

            <figure class="repo-avatar">
              <img src="/static/img/repo-avatar48.png" alt="{{repo.name}}">
              {% if repo.is_public %}
              <span class="private"><i class="icon-unlock"></i></span>
              {% else %}
              <span class="private"><i class="icon-lock"></i></span>
              {% endif %}
            </figure>
            <div class="summary">
              <div class="heading">
                <h3><a href="/{{user_name}}/{{repo.name}}/">{{repo.name}}</a></h3>
                <p class="origin"><i class="icon-caret-right"></i>Fork自<a href="#">yuwen</a><span class="divider">/</span><a href="#">gitshell</a></p>
              </div>

              <div class="detail">
                <p class="desc" title="{{repo.desc}}">{{repo.desc|truncatechars:"80"}}</p>
              </div>
            </div>

          </section>
        {% endfor %}
      {% else %}
      <p class="alert blank-alert"><i class="icon-bell"></i>你还没没有创建任何仓库。</p>
      {% endif %}

    {% comment %}
    <aside class="sidebar">

      <div class="create section">
        <div class="inner">
          <a href="/{{user.username}}/-/repo/create/" class="btn">新建仓库</a>
          <p>还可以创建<span>98</span>个仓库</p>
        </div>
      </div>

        <section class="capacities section">
          <div class="inner">
          <div class="item">
              <div class="dt">仓库数<span class="used">{{userprofile.get_total_repo}}</span><span class="divider">/</span><span class="capacity">100</span></div>
              <div class="progress">
                <div class="bar" style="width: {{userprofile.get_used_repo_percent}}%;"></div>
              </div>
            </div>

            <div class="item">
              <div class="dt">仓库配额<span class="used">{{userprofile.get_readable_used_quote}}</span><span class="divider">/</span><span class="capacity">{{userprofile.get_readable_quote}}</span></div>
              <div class="progress progress-danger">
                <div class="bar" style="width: {{userprofile.get_used_quote_percent}}%;"></div>
              </div>
            </div>
          </div>
        </section>

      <section class="activity section">
        <h2 class="heading">最近活动的仓库</h2>
        <ul class="nav nav-list">
          {% for repo in repo_list|slice:':6' %}
          <li><i class="icon-lock"></i><a href="/{{user_name}}/{{repo.name}}/"><span class="user">{{user_name}}</span><span class="divider">/</span><span class="repo-name">{{repo.name}}</span></a></li>
          {% endfor %}
        </ul>
      </section>
    </aside>
    {% endcomment %}

    </div>
  </div>
</div>

{% endblock %}

{% block js %}
    <script>
    $(function(){
        $('.c_repo').tooltip({ selector: "a[rel=tooltip]" });
    });
    </script>
{% endblock %}
